/*
 * @Author: xiawei 1243162387@qq.com
 * @Date: 2024-11-14 23:50:53
 * @LastEditors: xiawei 1243162387@qq.com
 * @LastEditTime: 2024-11-27 00:58:00
 */
import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper'
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'


let app: any = null;
function render(props: any = {}) {
    const { container } = props;
    app = createApp(App)
    app.mount(container ? container.querySelector('#vue3-vite-app') : '#vue3-vite-app');
}
const headOriginFn = document.head.appendChild.bind(document.head)
const initQianKun = () => {
    renderWithQiankun({
        mount(props: any) {
            render(props)
        },
        bootstrap() { },
        unmount() {
            app.unmount()
            app = null
        },
        update() {}
    })
}
// 独立运行时
// @ts-ignore
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQianKun() : render()
